package nayasis.study.gson;

import nayasis.common.model.NData;

import org.junit.Test;

import com.google.gson.Gson;

public class GsonTest {

    @Test
    public void test() {
        
        String json = "{buyer:'Happy Camper',creditCard:'4111-1111-1111-1111',"
                + "lineItems:[{name:'nails',priceInMicros:100000,quantity:100,currencyCode:'USD'}]}";
        
        Gson gson = new Gson();
        
        Cart cart = gson.fromJson( json, Cart.class );

        System.out.println( cart );
        
        NData data = new NData( json );
        
        System.out.println( "data" );
        System.out.println( data );
        System.out.println( data.get( "lineItems" ) );
        
        data.remove( "creditCard" );
        System.out.println( data.toJson() );
        
    }
    
}
